#pragma once

#include <linux/types.h>

#define NR_HASH    997
#define BLOCK_SIZE 1024

#define READ       0
#define WRITE      1

#define MAJOR(a)   (((unsigned)(a)) >> 8)
#define MINOR(a)   ((a)&0xff)

extern void buffer_init(void);

struct buffer_head {
    char *b_data;                    /* pointer to data block (1024 bytes) */
    unsigned long b_size;            /* block size */
    unsigned long b_blocknr;         /* block number */
    dev_t b_dev;                     /* device (0 = free) */
    unsigned short b_count;          /* users using this block */
    unsigned char b_uptodate;
    unsigned char b_dirt;            /* 0-clean,1-dirty */
    unsigned char b_lock;            /* 0 - ok, 1 -locked */
    unsigned char b_req;             /* 0 if the buffer has been invalidated */
    struct wait_queue *b_wait;
    struct buffer_head *b_prev;      /* doubly linked list of hash-queue */
    struct buffer_head *b_next;
    struct buffer_head *b_prev_free; /* doubly linked list of buffers */
    struct buffer_head *b_next_free;
    struct buffer_head *b_this_page; /* circular list of buffers in one page */
    struct buffer_head *b_reqnext;   /* request queue */
};

#ifdef __KERNEL__

extern dev_t ROOT_DEV;

#endif
